	<script language="javascript" type="text/javascript" src="<?php echo base_url(); ?>assets/js/tiny_mce/tiny_mce.js"></script>
	<script language="javascript" type="text/javascript">
		tinyMCE.init({
			mode : "exact",
			elements : "cmaincontent",

			theme : "advanced",
			plugins : "advimage,advlink,media,contextmenu,paste",
			theme_advanced_buttons1_add_before : "newdocument,separator",
			theme_advanced_buttons1_add : "fontselect,fontsizeselect",
			theme_advanced_buttons2_add : "separator,forecolor,backcolor,liststyle",
			theme_advanced_buttons2_add_before: "pastetext,pasteword,cut,copy,separator,",
			theme_advanced_buttons3_add_before : "",
			<!--theme_advanced_buttons3_add : "media",-->
			theme_advanced_toolbar_location : "top",
			theme_advanced_toolbar_align : "left",
			extended_valid_elements : "hr[class|width|size|noshade]",
			file_browser_callback : "ajaxfilemanager",
			paste_use_dialog : false,
			theme_advanced_resizing : true,
			theme_advanced_resize_horizontal : true,
			apply_source_formatting : true,
			force_br_newlines : true,
			force_p_newlines : false,	
			relative_urls : true,
			//  VERRRRYYYYY   IMPORTANT TO GET CONTENT IN SERVER SIDE			
			setup : function(ed) { 
      		ed.onChange.add(function(ed, l) { 
         	var hidden = document.getElementById('cmaincontent');
			var hidden2 = document.getElementById('cmaincontent_tr');
         	hidden.value = l.content; }); }

		});

		function ajaxfilemanager(field_name, url, type, win) {
			var ajaxfilemanagerurl = "../../../../../assets/js/tiny_mce/plugins/ajaxfilemanager/ajaxfilemanager.php";
			switch (type) {
				case "image":
					break;
				case "media":
					break;
				case "flash": 
					break;
				case "file":
					break;
				default:
					return false;
			}
            tinyMCE.activeEditor.windowManager.open({
                url: "../../../../../assets/js/tiny_mce/plugins/ajaxfilemanager/ajaxfilemanager.php",
                width: 750,
                height: 400,
                inline : "yes",
                close_previous : "no"
            },{
                window : win,
                input : field_name
            });
		}
	</script>

<div class="RightColumn">
<form action="<?php echo base_url().index_page(); ?>/adminpage/cpanel/mailtemplate_manipulate/" method="post" enctype="multipart/form-data" name="adminForm" id="adminForm" autocomplete="off">
            <div class="P10">
                <h2 class="Title01 P10 BorderBot01">Email template - Edit item</h2>
                 
                <div class="P10">
                <div id="en">
                    <h4 class="Title02 P10Bot">1. Enter Title:</h4>
                    <p class="FS12 P10Bot">
                        Name of your mail
                    </p>
                    <div class="BlueBackground M20Bot">
                        <input  type="text"  name="txtName1" id="txtName1" class="AllBoxText" value="<?php echo isset($banners[0]['title'])?$banners[0]['title']:""; ?>" style="width:30%;" />
                    </div>                    
                    <h4 class="Title02 P10Bot">2. Enter the Description:</h4>
                    <p class="FS12 P10Bot">
                        This is the main content of your email.
                    </p>
                    <div class="BlueBackground M20Bot"> 
                        <textarea id="cmaincontent" name="maincontent1" style="width: 80%; height: 500px"><?php echo isset($banners[0]['body'])?$banners[0]['body']:""; ?></textarea>
                    </div>
                    </div>
                    <h4 class="Title02 P10Bot">3. Image:</h4>
                    <p class="FS12 P10Bot">
                        Please choose an image file.
                    </p>
                    <div class="BlueBackground M20Bot">
                        <div class="Container">
					        <div class="Picture">
						    <?php if (isset($banners[0]['image']))
							{
							?>
						        <img src="<?php echo base_url(); ?>upload_file/article/<?php echo $banners[0]['image']; ?>" width="279px" />
                            <?php 
							}
							else
							{
							?>
                            <img src="<?php echo base_url(); ?>assets/img/noimage.png" width="280px" />
                            <?php 
							}
							?>
					        </div>
					        <div class="Description1">
                                <p class="P10Bot"><strong>Allow file type</strong>: png, jpg, gif. <strong>Max size</strong>: 1 MB</p>
                                <ul class="UpLoadImage">
                                    <li><input  type="file" name="image" class="AllBoxText" style="width:300px;" /></li>
                                    
                                </ul>
					        </div>
				        </div>
                    </div>
                    <p class="W95">
                    <input type="hidden" name="currentid" value="<?php echo $id; ?>" />
                        <div style="width:100px;float:left"><a style="cursor:pointer" onclick="javascript: document.forms[0].submit();"  class="Button01" title="Save">Save</a></div>
                        <?php if($id>0) { ?>
                        <div style="width:20px;float:left">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</div><div style="width:200px;float:left"><a style="cursor:pointer" href="<?php echo base_url().index_page(); ?>/adminpage/cpanel/sendmailtemplate/<?php echo $banners[0]['id']; ?>"  class="Button01" title="Save">Send mail to subscribers</a></div>
                         <?php } ?>
                        <div style="width:20px;float:left">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</div><div style="width:100px;float:left"><a  href="<?php echo base_url().index_page(); ?>/adminpage/cpanel/mailtemplate" class="Button01" title="Save">Cancel</a></div>
                    </p>
					<p class="W95">&nbsp;</p>
                </div>
            </div>
            </form>
</div>
<script>
jQuery(document).ready(function(){
	jQuery("#mailtemplate").addClass('current');
});
</script>